# auto load
extends Node


enum GameScene {
    START_SCENE,
    READY_SCENE,
    MAIN_SCENE,
    #DATA_LOAD_SCENE,
}


enum GameState {
    NO_STARTED,
    PLAYING,
    PAUSED,
    OVER,
}

@onready var loading_scene: CanvasLayer = $LoadingScene

@export var scenes_dict: Dictionary[GameScene, PackedScene]

var current_game_state: GameState = GameState.NO_STARTED
var scene_cache_dict: Dictionary[GameScene, Node]


func _ready() -> void:
    set_loading_scene_active(false)
    pass


func set_loading_scene_active(active: bool) -> void:
    if not active:
        loading_scene.hide()
        loading_scene.process_mode = Node.PROCESS_MODE_DISABLED
    else:
        loading_scene.process_mode = Node.PROCESS_MODE_INHERIT
        loading_scene.show()


func switch_scene(scene: GameScene) -> void:
    #var s: Node = scene_cache_dict.get(scene)
    #if not s:
        #s = scenes_dict[scene].instantiate()
        #scene_cache_dict[scene] = s
    
    get_tree().change_scene_to_packed(scenes_dict[scene])
    #var curr_scene := get_tree()


func goto_start_scene() -> void:
    pass


func goto_ready_scene() -> void:
    pass
